﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using NASA.BeAMartian.Model;
using CraterCity.Service.Components.DataContract;

namespace NASA.BeAMartian.Views
{
    public partial class RoverTaggingTaskCompleted : PhoneApplicationPage
    {
        public RoverTaggingTaskCompleted()
        {
            InitializeComponent();
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            TaskData td = ApplicationContext.Instance.TaggingTaskData;

            bool isAnonymous = ApplicationContext.Instance.UserData == null || ApplicationContext.Instance.UserData.UserID == 0;

            if (isAnonymous)
            {
                this.CompletionText.Visibility = System.Windows.Visibility.Collapsed;
                this.CompletionText_Anon.Visibility = System.Windows.Visibility.Visible;
                this.hlLogin.Visibility = System.Windows.Visibility.Visible;
                this.imgReputation.Visibility = System.Windows.Visibility.Collapsed;
                this.pthReputation.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                this.CompletionText_Anon.Visibility = System.Windows.Visibility.Collapsed;
                this.CompletionText.Visibility = System.Windows.Visibility.Visible;
                this.hlLogin.Visibility = System.Windows.Visibility.Collapsed;
                this.CompletionText.Text = "You have completed " + td.TaskCount + " Tag Mars tasks. Complete " + td.TasksForNextBadge + " Tag Mars tasks to earn your next Badge!";
                this.imgReputation.Visibility = System.Windows.Visibility.Visible;
                this.pthReputation.Visibility = System.Windows.Visibility.Visible;
            }
        }

        private void btnCC_Click(object sender, RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Uri("/Views/Participate/MapRoom.xaml?x=2", UriKind.Relative));

        }

        private void ccTagging_Click(object sender, RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Uri("/Views/Participate/MapRoom.xaml?x=1", UriKind.Relative));

        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Uri("/Welcome.xaml", UriKind.Relative));
        }
    }
}
